﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessObjects;
using System.Configuration;

namespace DataAccess
{
    public class HoSoFactory
    {
        private static readonly string dataProvider = ConfigurationManager.AppSettings.Get("DataProvider");
        private static readonly DataFactory factory = DataFactories.GetFactory(dataProvider);
        public static HoSo GetHoSo(int giaTri)
        {
            ThamChieuDuLieu thamChieuDuLieu = factory.ThamChieuDuLieu.GetThamChieuDuLieu(giaTri, typeof(HoSo).ToString());
            if (thamChieuDuLieu.Con.TenKieuDuLieu == typeof(NhanVien).ToString())
            {
                return factory.NhanVien.GetNhanVien(thamChieuDuLieu.GiaTri);
            }
            else if (thamChieuDuLieu.Con.TenKieuDuLieu == typeof(GiangVienThinhGiang).ToString())
            {
                return factory.GiangVienThinhGiang.GetGiangVienThinhGiang(thamChieuDuLieu.GiaTri);
            }
            return null;
        }
    }
}
